import React, { Component } from 'react'

import { Carousel, WingBlank } from 'antd-mobile';
import {getSwiper} from '../../servers'
import './swiper.less'

export default class Swiper extends Component {
  constructor(){
    super(),
    this.state = {
      data:[]
    }
  }
  
  componentDidMount() {
    getSwiper()
        .then((resp)=>{
         this.setState({
           data:resp.data.data
         })
        })
    
  }

  render() {
  
    return (
      <div  className="bbb">
        
          <Carousel
         
              selectedIndex
              autoplay={true}
              infinite={true}
              >
                {this.state.data.map((item)=>{
                  return (
                    <div key={item.id}>
                      <img  src={item.img} alt={item.title} />
                    </div> 
                          )
                 })
                }
          </Carousel>
      </div>
    )
  }
}
